<!--
 * @Author: 陈迪秀 1170776994@qq.com
 * @Date: 2024-02-26 14:45:00
 * @LastEditors: 陈迪秀 1170776994@qq.com
 * @LastEditTime: 2024-03-01 13:03:09
 * @FilePath: \stell-mall\src\components\floating-window\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div v-if="classARouter" class="menu">
    <div class="menu-view">
      <div
        class="menu-list"
        v-for="(item, index) in floatingWindow"
        :key="index"
      >
        <el-popover
          :placement="index === 1 ? 'left' : 'left-start'"
          :width="168"
          trigger="hover"
          :disabled="index === 3"
          offset="10"
        >
          <template #reference>
            <div class="reference-view" @click="handelClick(item)">
              <i :class="['iconfont', item.icon]"></i>
              <p>{{ item.name }}</p>
            </div>
          </template>
          <div class="contact-telephone" v-if="item.name === '电话沟通'">
            {{ item.contact?.telephone }}
          </div>
          <div
            class="contact-view"
            v-if="['微信咨询', '关注我们'].includes(item.name)"
          >
            <h1>{{ item.contact?.name }}</h1>
            <p>{{ item.contact?.title }}</p>
            <img :src="item.contact?.img" alt="" />
          </div>
        </el-popover>
      </div>
    </div>
    <el-backtop :bottom="120" :right="16">
      <div class="toTop">
        <i class="iconfont icon-Top"></i>
        <p>TOP</p>
      </div>
    </el-backtop>
    <access-services-dialog
      v-model="show"
      @close="show = !show"
      @handleConfirm="handleConfirm"
    />
    <service-telephone-dialog v-model="show1" @close="show1 = !show1" />
  </div>
</template>
<script lang="ts" setup>
import { ref, watch } from "vue";
import { floatingWindow } from "./constants";
import AccessServicesDialog from "../access-services-dialog/index.vue";
import ServiceTelephoneDialog from "../service-telephone-dialog/index.vue";
import { useWatchRouter } from "@/hooks/use-router/index";
const { router, suspensionShow, classARouter } = useWatchRouter();
const show = ref<boolean>(false);
const show1 = ref<boolean>(false);
const handelClick = (item: any) => {
  // console.log(item);
  if (item.name === "获取方案") show.value = true;
};
const handleConfirm = () => {
  console.log("提交成功");
  show.value = false;
  show1.value = true;
};
</script>
<style lang="scss" scoped>
.menu {
  width: 78px;
  height: 400px;
  background: #ffffff;
  position: absolute;
  right: 16px;
  bottom: 340px;
  position: fixed;
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.04);
  border-radius: 4px 4px 0 0;
  .menu-view {
    border-radius: 3px 3px 3px 3px;
  }
  .menu-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 3px 3px 3px 3px;
    border-bottom: 1px solid #ebecf0;
    background-color: #ffffff;
    border-bottom: 0;
  }
  .menu-list:nth-child(1) {
    border-radius: 3px 3px 0 0;
    .reference-view {
      border-radius: 3px 3px 0 0;
    }
  }
  .menu-list:nth-child(4) {
    /* border-bottom: 1px solid #ebecf0; */
    .reference-view {
      border-radius: 0 0 3px 3px;
      border-bottom: 1px solid #ebecf0;
      &:hover {
        border-bottom: 1px solid #1678ff;
      }
    }
  }
  .reference-view {
    width: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #7a869a;
    border: 1px solid #ebecf0;
    border-bottom: 0;
    cursor: pointer;
    padding: 24px 0;
    p {
      width: 32px;
    }
    &:hover {
      background-color: #1678ff;
      color: #ffffff;
      border-color: #1678ff;
    }
  }
  .svg-back {
  }
}
.contact-view {
  width: 141px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  h1 {
    font-size: 13px;
    color: #172b4d;
    font-weight: 600;
    margin-bottom: 3px;
  }
  p {
    font-size: 12px;
    color: #6b778c;
    margin-bottom: 3px;
  }
  img {
    width: 125px;
    height: 125px;
  }
}
.contact-telephone {
  font-size: 20px;
  color: #1678ff;
  cursor: pointer;
}
:deep(.el-backtop) {
  height: 107px !important;
  width: 78px !important;
}

.toTop {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background-color: #fff;
  border: 1px solid #ebecf0;
  border-radius: 3px 3px 3px 3px;
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.04);
  color: #6b778c;
}
.iconfont {
  font-size: 24px;
  margin-bottom: 8px;
}
</style>
